package com.cindata

class TransferBatch
{
    //批次名称
    String batchName
    //处理方式
    String processMethod
    //资产管理机构
    Account manageAccount
    //转让时间
    Date createdDate = new Date()
    Date modifiedDate = new Date()
    //操作人
    User createBy
    User modifyBy

    static constraints = {
        batchName nullable: true, blank: true
        processMethod nullable: true, blank: true
        manageAccount nullable: true, blank: true

        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
        createBy nullable: true, blank: true
        modifyBy nullable: true, blank: true
    }

    def springSecurityService

    def beforeInsert()
    {
        def username = springSecurityService?.getPrincipal()?.username
        createBy = User.findByUsername(username)
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
        def username = springSecurityService?.getPrincipal()?.username
        modifyBy = User.findByUsername(username)
    }

}
